package com.chenyu.exception;


import com.chenyu.enums.SystemErrorCode;

/*
    自定义异常:
        1.继承一个已知的异常类
        2.创建一些构造方法,调用父类的构造方法
         new  BusinessException("系统异常")
            --catch(Exception e)
                e.getMessage();

 */
public class BusinessException extends RuntimeException{

    private SystemErrorCode systemErrorCode;

    public BusinessException() {
        super();
    }

    public BusinessException(String msg) {
        super(msg);
    }
    public BusinessException(SystemErrorCode systemErrorCode) {
        super(systemErrorCode.getMsg());
        this.systemErrorCode=systemErrorCode;
    }

    public SystemErrorCode getSystemErrorCode() {
        return systemErrorCode;
    }

    public void setSystemErrorCode(SystemErrorCode systemErrorCode) {
        this.systemErrorCode = systemErrorCode;
    }
}
